home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
AMIGA
/
(A)Z
/
(A)Z11.ADF
/
Scheme
/
HOP.scm
< prev
next >
Wrap
Text File
|
1988-03-01
|
515b
|
31 lines
;;; HOP.scm
;;;
;;; Useful Higher-Order Procedures
;;;
(define (filter predicate source-list)
(cond ((null? source-list) '())
((predicate (car source-list))
(cons (car source-list)
(filter predicate (cdr source-list)) ))
(else
(filter predicate (cdr source-list)) )))
(define (repeat thunk n)
(if (< n 1)
#u
(begin
(thunk)
(repeat thunk (- n 1)) )))
(define (repeated f n)
(if (< n 1)
(lambda (x) x)
(lambda (x) ((repeated f (- n 1)) (f x))) ))
;;; EOF HOP.scm